package vip.lsjscl.flowboot.workflow.repository;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import vip.lsjscl.flowboot.workflow.entity.DKActivity;
import vip.lsjscl.flowboot.workflow.entity.DKTransition;

import java.util.List;

/**
 * 变迁存储库
 *
 * @author zhangxingju
 * @date 2025/02/14
 */
@Repository
public interface DKTransitionRepository extends JpaRepository<DKTransition, String> {
    // 根据起始活动查询变迁记录
    List<DKTransition> findAllByFromActivity(DKActivity activity);

    // 根据目标活动查询变迁记录，用于获取上一个活动节点
    List<DKTransition> findAllByToActivity(DKActivity activity);

    // 根据起始活动查询变迁记录
    List<DKTransition> findAllByFromActivityAndToActivityIn(DKActivity currentActivity, List<DKActivity> nextActivity);

    List<DKTransition> findByBusinessId(String businessId);
}